<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class AdminUser extends BaseModel
{
    public function roles()
    {
    	return $this->belongsToMany('App\Models\AdminRole', 'admin_role_users',
            'user_id', 'role_id');
    }
    
    public function setAvatarAttribute($value)
    {
        return $this->attributes['avatar'] = env('ALIOSS_HOST').'/'.$value;
    }
    
    public function storeRoleUser()
    {
        return $this->belongsToMany('App\Models\StoreRoleUser', 'store_role_users',
	        'user_id', 'role_id');
    }
}
